package ink.lovejinhu.leetcode;

/**
 * @author jinhu
 * created 2021-07-21 17:55
 */
public class Solution_0520 {

    public boolean detectCapitalUse(String word) {
        if (word.length() == 1) return true;
        if (word == word.toUpperCase()) return true;
        if (word == word.toLowerCase()) return true;
        return (word.charAt(0) >='A' && word.charAt(0) <= 'Z') && dfs(word.substring(1, word.length()));
    }

    public boolean dfs(String word) {
        if (word.length() == 0) return true;
        return word == word.toUpperCase() || word == word.toLowerCase();
    }

    public static void main(String[] args) {
        String tem = "012345";
        System.out.println(tem.substring(0, 2));
    }
}
